﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom.Compiler;

namespace RobotBattle2.Scripting {
	public sealed class UnaryExpression : Expression {
		public UnaryExpression() { }

		public UnaryExpression(Expression expression, UnaryOperator @operator) {
			this.Expression = expression;
			this.Operator = @operator;
		}

		public Expression Expression { get; set; }
		public UnaryOperator Operator { get; set; }

		public override void Dump(IndentedTextWriter writer) {
			writer.Write(Operator);
			writer.Write('(');
			Expression.Dump(writer);
			writer.Write(')');
		}

		public override ExpressionType Type { get { return ExpressionType.Unary; } }
	}
}
